home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / smaltalk / gnu_st.lha / gnu_st / smalltalk-1.1.1 / SystemDictionary.st < prev    next >
Text File  |  1991-09-12  |  3KB  |  82 lines

  1. "======================================================================
  2. |
  3. |   SystemDictionary Method Definitions
  4. |
  5.  ======================================================================"
  6.  
  7.  
  8. "======================================================================
  9. |
  10. | Copyright (C) 1990, 1991 Free Software Foundation, Inc.
  11. | Written by Steve Byrne.
  12. |
  13. | This file is part of GNU Smalltalk.
  14. |
  15. | GNU Smalltalk is free software; you can redistribute it and/or modify it
  16. | under the terms of the GNU General Public License as published by the Free
  17. | Software Foundation; either version 1, or (at your option) any later version.
  18. | GNU Smalltalk is distributed in the hope that it will be useful, but WITHOUT
  19. | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  20. | FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
  21. | details.
  22. | You should have received a copy of the GNU General Public License along with
  23. | GNU Smalltalk; see the file COPYING.  If not, write to the Free Software
  24. | Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  
  25. |
  26.  ======================================================================"
  27.  
  28.  
  29. "
  30. |     Change Log
  31. | ============================================================================
  32. | Author       Date       Change 
  33. | sbyrne     22 Apr 90      Fixed Dependencies to be an IdentityDictionary
  34. |              instead of a regular Dictionary.  This has better
  35. |              semantics and is faster.
  36. |
  37. | sbyrne      4 Jul 89      added initBlocks methods.
  38. |
  39. | sbyrne     25 Apr 89      created.
  40. |
  41. "
  42.  
  43. Dictionary variableSubclass: #SystemDictionary
  44.        instanceVariableNames: ''
  45.        classVariableNames: ''
  46.        poolDictionaries: ''
  47.        category: nil.
  48.  
  49. SystemDictionary comment: 
  50. 'I am a special form of dictionary.  Typically I only have one instance,
  51. called "Smalltalk", which is known to the Smalltalk interpreter.  I define
  52. several methods that are "system" related, such as #quitPrimitive.
  53. My instance also helps keep track of dependencies between objects.' !
  54.  
  55.  
  56. !SystemDictionary methodsFor: 'basic'!
  57.  
  58. initialize
  59.     InitBlocks _ OrderedCollection new.
  60.     self at: #Dependencies put: (IdentityDictionary new) 
  61.                                              "### I don't think this is
  62.                                                   the right way to do this"
  63. !
  64.  
  65. addInit: aBlock
  66.     "Adds 'aBlock' to the array of blocks to be invoked after every start
  67.      of the system."
  68.     InitBlocks add: aBlock
  69. !
  70.  
  71. doInits
  72.     "Called after the system has loaded the image, this will invoke any
  73.      init blocks that have been installed."
  74.     InitBlocks do: [ :aBlock | aBlock value ]
  75. !
  76.  
  77. dependenciesAt: anObject
  78.     ^(Smalltalk at: #Dependencies) at: anObject
  79. !!
  80.